<?php
/*
|--------------------------------------------------------------------------
| Web Routes 通用的路由
|--------------------------------------------------------------------------
|
| This file is where you may define all of the routes that are handled
| by your application. Just tell Laravel the URIs it should respond
| to using a Closure or controller method. Build something great!
|
*/

//demo
Route::get('/api/demo/success', 'Api\DemoController@success');
Route::get('/api/demo/fail', 'Api\DemoController@fail');
Route::get('/api/demo/list', 'Api\DemoController@result');
Route::get('/api/demo/page', 'Api\DemoController@page');

Route::post('/api/token','Api\LoginController@login');

//小程序登录
Route::post('/api/wx/code','Api\MiniProgramController@code');
//小程序获取token
Route::post('/api/wx/token','Api\MiniProgramController@token');
//微信签名
Route::get('/api/sign','Api\WeChatController@sign');

//消息推送
Route::any('/test','Api\ServerController@test');
Route::any('/message','Api\ServerController@index');
//设置菜单
Route::any('/menu','Api\ServerController@menu');

//账号登录
Route::any('/api/login', 'AuthController@login');
//账号退出
Route::post('/api/logout', 'AuthController@logout');
//账号刷新
Route::group(['middleware' => 'api','prefix' => 'auth'], function () {
    Route::post('refresh', 'AuthController@refresh');
    Route::any('me', 'AuthController@me');
});


//必须要登录的api路由
Route::group(['namespace' => 'Api','prefix'=>'api', 'middleware' => ['api.auth']], function() {

    Route::post('message', 'MessageController@send');

});